package com.firexxx.study.future;

import java.util.concurrent.CompletableFuture;
import java.util.concurrent.ExecutionException;

/**
 * @description: TODO
 * @author: zhuangzhang2
 * @date: 2021-02-16 22:57
 */
public class CompletableFutureMain {

    public static void main(String[] args) throws ExecutionException, InterruptedException {
//        System.out.println(
                CompletableFuture future = CompletableFuture.supplyAsync(() -> {
//                    try {
//                        Thread.sleep(10000);
//                    } catch (InterruptedException e) {
//                        e.printStackTrace();
//                    }
                    System.out.println("1");
                    return "111";
                }).thenApplyAsync(t -> {
//                    try {
//                        Thread.sleep(10000);
//                    } catch (InterruptedException e) {
//                        e.printStackTrace();
//                    }
                    System.out.println("2");
                    return t;
                }).thenApplyAsync(t -> {
//                    try {
//                        Thread.sleep(10000);
//                    } catch (InterruptedException e) {
//                        e.printStackTrace();
//                    }
                    System.out.println("3");
                    return t;
                });
//        );
//        System.out.println(future.get());
    }

}
